﻿// Fill out your copyright notice in the Description page of Project Settings.


#include "UI/WidgetController/StarrySkyWidgetController.h"

#include "AbilitySystem/StarrySkyAbilitySystemComponent.h"
#include "AbilitySystem/StarrySkyAttributeSet.h"
#include "Play/StarrySkyPlayerController.h"
#include "Play/StarrySkyPlayerState.h"

void UStarrySkyWidgetController::SetWidgetControllerParams(const FWidgetControllerParams& WCParams)
{
	// 通过传入的结构体来设置属性
	AbilitySystemComponent = WCParams.AbilitySystemComponent;
	AttributeSet = WCParams.AttributeSet;
	PlayerController = WCParams.PlayerController;
	PlayerState = WCParams.PlayerState;
}

void UStarrySkyWidgetController::BroadcastInitialValues()
{
}

void UStarrySkyWidgetController::BindCallbacksToDependencies()
{
}

AStarrySkyPlayerController* UStarrySkyWidgetController::GetStarrySkyPC()
{
	if (StarrySkyPlayerController==nullptr)
	{
		StarrySkyPlayerController = Cast<AStarrySkyPlayerController>(PlayerController);
	}
	return StarrySkyPlayerController;
}

AStarrySkyPlayerState* UStarrySkyWidgetController::GetStarrySkyPS()
{
	if (StarrySkyPlayerState==nullptr)
	{
		StarrySkyPlayerState = Cast<AStarrySkyPlayerState>(PlayerState);
	}
	return StarrySkyPlayerState;
}

UStarrySkyAbilitySystemComponent* UStarrySkyWidgetController::GetStarrySkyASC()
{
	if (StarrySkyAbilitySystemComponent==nullptr)
	{
		StarrySkyAbilitySystemComponent = Cast<UStarrySkyAbilitySystemComponent>(AbilitySystemComponent);
	}
	return StarrySkyAbilitySystemComponent;
}

UStarrySkyAttributeSet* UStarrySkyWidgetController::GetStarrySkyAS()
{
	if (StarrySkyAttributeSet==nullptr)
	{
		StarrySkyAttributeSet = Cast<UStarrySkyAttributeSet>(AttributeSet);
	}
	return StarrySkyAttributeSet;
}
